fn create_fn() -> impl Fn(i32) -> i32 {
    let text = "Fn".to_owned();
    move |a| {println!("This is a: {}, and parameter is:{}", text, a); 35}
}

fn create_fnmut() -> impl FnMut() {
    let text = "FnMut".to_owned();
    move || println!("This is a: {}", text)
}

fn create_fnonce() -> impl FnOnce() {
    let text = "FnOnce".to_owned();
    move || {println!("This is a: {}", text)}

    // we can also use the following statements to acheive the same result
    // use std::mem;
    //  || {println!("This is a: {}", text); mem::drop(text);}
}

fn main() {
    let fn_plain = create_fn();
    println!("the execute result of fn_plain is:{}", fn_plain(20));

    // if we remove keywork `mut`, there will be an error:cannot borrow `fn_mut` as mutable, as it is not declared as mutable
    let mut fn_mut = create_fnmut();
    fn_mut();

    let fn_once = create_fnonce();
    fn_once();

}